package math.petrinets.lpsolve;

import lpsolve.LpSolveException;

import org.junit.Assert;
import org.junit.Test;

public class SimplexTest {

    @Test
    public void parametrizedSimplexRunTest() throws LpSolveException {
	Simplex s = new Simplex();

	int[][] c = new int[][] { { -1, 0, 0, 1 }, { 1, -1, 0, 0 }, { 1, 0, -1, 0 }, { 0, 1, 0, -1 }, { 0, 0, 1, -1 } };
	int[][] pre = new int[][] { { 1, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 1 }, { 0, 0, 0, 1 } };
	int[] M0 = new int[] { 1, 0, 0, 0, 0 };
	int[][] V = new int[][] { { 1, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 1 } };
	int[] d = new int[] { 1, 2, 3, 1 };
	double result = s.resolveSimplex(c, pre, M0, V, d);
	Assert.assertTrue(5.000000000000001d == result);
    }
}
